<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'main';
$return=array();
$return['pluginset']=$this->plugin_setting('basic');
if($_RQ['op']=='main'){
	$pindex = max(1, intval($_RQ['page']));
	$psize = 10;
	$params=array('uniacid'=>$_SESSION['uniacid'],'uid'=>$_SESSION['uid'],'order'=>0);
	$postdata=get_postdata();
    $orderby='id desc';
	$total='';
	$return['list']=pdo_getslice('jy_bargain_actor',$params,array($pindex,$psize),$total,$fields,'',$orderby);
	foreach($return['list'] as &$v){
			$good=pdo_get('jy_bargain_goods',array('id'=>$v['goods_id']),array('end_price','end_time','time_limit','goods_id'));
			$good2=pdo_get('jy_weishop_goods',array('id'=>$good['goods_id']),array('image','price','title'));
			$v['image']=tomedia($good2['image']);
			$v['price']=$good2['price'];
			$v['end_price']=$good['end_price'];
			$v['title']=$good2['title'];
			$v['swi']=0;
			if($good['end_time']<time()){
				$v['swi']=2;
			}
			if($good['time_limit']>0){
				if($v['created_time']+$good['time_limit']*3600<time()){
				$v['swi']=1;
			}
			}
			
			if($good['end_price']>=$v['now_price']){
				$v['swi']=3;
			}
	}
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$return['sharedata']=array(
			'title'=>$basic['share_title']?$basic['share_title']:'我的砍价',
			'desc'=>$basic['share_desc']?$basic['share_desc']:'在线砍价商城！',
			'link'=>custom_url('jy_bargain/act//fromuser='.$_SESSION['uid'],true),
			'imgUrl'=>tomedia($basic['share_image'])
	);
	set_html('title','我的砍价');
	exi($return);
}